package com.woniuxy.controller;

import com.woniuxy.entity.Drug;
import com.woniuxy.entity.DrugRepertory;
import com.woniuxy.entity.PageBean;
import com.woniuxy.entity.ResponseResult;
import com.woniuxy.service.DrugStoreService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class DrugStoreController {

    @Resource
    DrugStoreService drugStoreService;

    @PostMapping("/dr/{pageIndex}/{pageSize}")
    public ResponseResult<PageBean<DrugRepertory>> getAllStore(@PathVariable("pageIndex") int pageIndex,
                                               @PathVariable("pageSize") int pageSize,
                                               @RequestBody DrugRepertory drugRepertory){


        PageBean<DrugRepertory> drugPageBean=drugStoreService.selectStorePage(drugRepertory,pageIndex,pageSize);

        ResponseResult<PageBean<DrugRepertory>> responseResults=new ResponseResult<>(200,"ok",drugPageBean);
        return responseResults;
    }
}
